package com.diandiansong.app.entity;

import android.content.Context;

import com.google.gson.annotations.SerializedName;

import java.io.Serializable;
import java.util.ArrayList;

import diandiansong.library.utils.AFile;
import diandiansong.library.utils.BaseEntity;

public class CityInfo extends BaseEntity {
    private static final String KEY_CITYINFO = "CITYINFO";

    public static void saveCityInfo(Context context, CityInfo object) {
        AFile aFile = AFile.get(context, KEY_CITYINFO);
        aFile.put(KEY_CITYINFO, object);
    }

    public static CityInfo getCityInfo(Context context) {
        AFile aFile = AFile.get(context, KEY_CITYINFO);
        return (CityInfo) aFile.getAsObject(KEY_CITYINFO);
    }

    /**
     * message : null
     * data : [{"local_name":"浙江省","region_id":"1","list":[{"local_name":"杭州市","region_id":"2",
     * "list":[{"local_name":"上城区","region_id":"3"},{"local_name":"下城区","region_id":"4"}]}]}]
     */

    @SerializedName("data")
    private ArrayList<Data> data;

    public ArrayList<Data> getData() {
        return data;
    }

    public void setData(ArrayList<Data> data) {
        this.data = data;
    }

    public static class Data implements Serializable {
        /**
         * local_name : 浙江省
         * region_id : 1
         * list : [{"local_name":"杭州市","region_id":"2","list":[{"local_name":"上城区",
         * "region_id":"3"},{"local_name":"下城区","region_id":"4"}]}]
         */

        @SerializedName("local_name")
        private String localName;
        @SerializedName("region_id")
        private String regionId;
        @SerializedName("list")
        private ArrayList<ListX> list;

        public String getLocalName() {
            return localName;
        }

        public void setLocalName(String localName) {
            this.localName = localName;
        }

        public String getRegionId() {
            return regionId;
        }

        public void setRegionId(String regionId) {
            this.regionId = regionId;
        }

        public ArrayList<ListX> getList() {
            return list;
        }

        public void setList(ArrayList<ListX> list) {
            this.list = list;
        }

        public static class ListX implements Serializable {
            /**
             * local_name : 杭州市
             * region_id : 2
             * list : [{"local_name":"上城区","region_id":"3"},{"local_name":"下城区","region_id":"4"}]
             */

            @SerializedName("local_name")
            private String localName;
            @SerializedName("region_id")
            private String regionId;
            @SerializedName("list")
            private ArrayList<Listz> list;

            public String getLocalName() {
                return localName;
            }

            public void setLocalName(String localName) {
                this.localName = localName;
            }

            public String getRegionId() {
                return regionId;
            }

            public void setRegionId(String regionId) {
                this.regionId = regionId;
            }

            public ArrayList<Listz> getList() {
                return list;
            }

            public void setList(ArrayList<Listz> list) {
                this.list = list;
            }

            public static class Listz implements Serializable {
                /**
                 * local_name : 上城区
                 * region_id : 3
                 */

                @SerializedName("local_name")
                private String localName;
                @SerializedName("region_id")
                private String regionId;

                public String getLocalName() {
                    return localName;
                }

                public void setLocalName(String localName) {
                    this.localName = localName;
                }

                public String getRegionId() {
                    return regionId;
                }

                public void setRegionId(String regionId) {
                    this.regionId = regionId;
                }
            }
        }
    }
}
